// TotalsWhiteboard
//
// This class represents the whiteboard space total aggregated data across all the clerks.
// This will include total tickets in the theater, money gained by clerks and theater, other useful stats, ect.
// It will be protected by a monitor and be maintained by all the clerks and read by the manager
// to make reports.
//

#include "TotalsWhiteboard.h"

// Initialize the TotalsWhiteboard object
TotalsWhiteboard::TotalsWhiteboard() {
	ticketClerkRevenue = new int[5];
	foodClerkRevenue = new int[5];
	availableTickets = 40;
	totalTicketsSold = 0;
	totalRevenue = 0;
	totalFoodRevenue = 0;
	totalTicketRevenue = 0;
	for (int i = 0; i < 5; i++) {
		ticketClerkRevenue[i] = 0;
		foodClerkRevenue[i] = 0;
	}
}
// De-allocate TotalsWhiteboard		
TotalsWhiteboard::~TotalsWhiteboard() {
	
}

int TotalsWhiteboard::getTotalRevenue(){
	return (totalFoodRevenue + totalTicketRevenue);
}

int TotalsWhiteboard::getTicketClerkRevenue(int clerkID){
	return ticketClerkRevenue[clerkID];
}

int TotalsWhiteboard::getFoodClerkRevenue(int clerkID){
	return foodClerkRevenue[clerkID];
}

// returns number of tickets that can be sold before the next showing
int TotalsWhiteboard::getAvailableTickets() {
	return availableTickets;
}
// returns total number of tickets sold by the theater		
int TotalsWhiteboard::getTotalTicketsSold() {
	return totalTicketsSold;
}		

void TotalsWhiteboard::incrementFoodRevenue(int clerkID, int value){
	foodClerkRevenue[clerkID] += value;
	totalFoodRevenue += value;
}

void TotalsWhiteboard::incrementTicketRevenue(int clerkID, int value){
	ticketClerkRevenue[clerkID] += value;
	totalTicketRevenue += value;
}

// sets the number of tickets that can be sold before the next showing
void TotalsWhiteboard::setAvailableTickets(int avail) {
	availableTickets = avail;
}
// sets the total number of tickets sold by the theater		
void TotalsWhiteboard::setTotalTicketsSold(int tickets) {
	totalTicketsSold = tickets;
}	
